import java.math.BigInteger;
import java.util.Objects;

public class supermarket {
    String name;//商品名称
    float price;//商品价格
    String number;//商品编号
    String time;//入库时间

    public supermarket(String name, float price, String classes, String quantity) {
        this.name = name;
        this.price = price;
        this.number = classes;
        this.time = quantity;
    }


    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getClasses() {
        return number;
    }

    public void setClasses(String classes) {
        this.number = classes;
    }

    public float getPrice() {
        return price;
    }

    public void setPrice(float price) {
        this.price = price;
    }

    public String getQuantity() {
        return time;
    }

    public void setQuantity(String time) {
        this.time = time;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof supermarket that)) return false;
        return Float.compare(price, that.price) == 0 && time == that.time  && Objects.equals(name, that.name) && Objects.equals(number, that.number);
    }

    @Override
    public int hashCode() {
        return Objects.hash(name, price, number, time);
    }

    @Override
    public String toString() {
        return "\t["+
                "商品名称：" + name  +
                ", 商品价格：" + price +
                ", 商品编号：" + number  +
                ", 商品的入库时间：" + time +"]"
                ;
    }
}
